FROM registry.prod.bbdops.com/dev/python_node:1.0
MAINTAINER  hyy

USER root

VOLUME /data1
ENV PYTHONPATH=/opt/app \
    LOG_PATH=/data1/log \
    FILE_PATH=/data1/log \
    DATA_BACK_PATH=/data1/log
COPY squirrel_core/script/depend /opt/app/
COPY squirrel_core/script/crontab /etc/cron.d/squirrel-cron
RUN pip install --upgrade pip
RUN pip install -r /opt/app/depend -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com \
    && chmod 0644 /etc/cron.d/baichuan-cron \
    && apt-get install cron --assume-yes --allow-unauthenticated

COPY squirrel_core /opt/app/squirrel_core
COPY baichuan_spiders /opt/app/baichuan_spiders
COPY baichuan_crawl_node /opt/app/baichuan_crawl_node
RUN mv /opt/app/squirrel_core/commons/config/ssh_key $HOME/.ssh \
    && chmod 700 $HOME/.ssh/id_rsa \
    && rm -rf /opt/app/depend

WORKDIR /opt/app

COPY squirrel_core/script/supervisor.conf /etc/supervisor/conf.d/baichuan.conf

CMD ["sh" ,"./squirrel_core/script/docker_init.sh"]